﻿<Window x:Class="TechNewLogic.GraphIT.Printing.PrintPreviewWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:ml="clr-namespace:TechNewLogic.GraphIT.MultiLanguage"
		Title="{x:Static ml:MlResources.PrintPreview}" x:Name="root" Width="850" Height="650"
		x:ClassModifier="internal">

	<Window.Resources>
		<Color x:Key="ControlLightColor">White</Color>

		<Color x:Key="ControlMediumColor">WhiteSmoke</Color>

		<Style x:Key="{x:Type ListBoxItem}" TargetType="{x:Type ListBoxItem}">
			<Style.Resources>
				<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
						Color="Transparent" />
				<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
			</Style.Resources>
			<Setter Property="HorizontalContentAlignment" Value="Stretch" />
			<Setter Property="VerticalAlignment" Value="Bottom" />
		</Style>

		<Style x:Key="paperFormatListStyle" TargetType="ListBox">
			<Setter Property="Background" Value="Transparent" />
			<Setter Property="BorderThickness" Value="0" />
			<Setter Property="ItemsPanel">
				<Setter.Value>
					<ItemsPanelTemplate>
						<StackPanel Orientation="Horizontal" IsItemsHost="True" />
					</ItemsPanelTemplate>
				</Setter.Value>
			</Setter>
			<Setter Property="ItemTemplate">
				<Setter.Value>
					<DataTemplate>
						<RadioButton Content="{Binding DisplayName}" Margin="3"
								IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}}" />
					</DataTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="documentViewerStyle" TargetType="{x:Type DocumentViewer}">
			<Setter Property="Foreground"
					Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
			<Setter Property="Background"
					Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
			<Setter Property="FocusVisualStyle" Value="{x:Null}" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type DocumentViewer}">
						<Border BorderThickness="{TemplateBinding BorderThickness}"
								BorderBrush="{TemplateBinding BorderBrush}" Focusable="False">
							<Grid KeyboardNavigation.TabNavigation="Local">
								<Grid.Background>
									<SolidColorBrush Color="{DynamicResource ControlLightColor}" />
								</Grid.Background>
								<Grid.RowDefinitions>
									<RowDefinition Height="Auto" />
									<RowDefinition Height="*" />
									<RowDefinition Height="Auto" />
								</Grid.RowDefinitions>
								<ToolBar ToolBarTray.IsLocked="True"
										KeyboardNavigation.TabNavigation="Continue">
									<Button Command="{Binding PrintCommand, ElementName=root}"
											Content="{x:Static ml:MlResources.Print}" />
									<Separator />
									<Button Command="NavigationCommands.IncreaseZoom"
											CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
											Content="{x:Static ml:MlResources.ZoomIn}" />
									<Button Command="NavigationCommands.DecreaseZoom"
											CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
											Content="{x:Static ml:MlResources.ZoomOut}" />
									<Separator />
									<Button Command="NavigationCommands.Zoom"
											CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
											CommandParameter="100.0"
											Content="{x:Static ml:MlResources.ActualSize}" />
									<Button Command="DocumentViewer.FitToWidthCommand"
											CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
											Content="{x:Static ml:MlResources.FitToWidth}" />
									<Button Command="DocumentViewer.FitToMaxPagesAcrossCommand"
											CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
											CommandParameter="1"
											Content="{x:Static ml:MlResources.WholePage}" />
									<Button Command="DocumentViewer.FitToMaxPagesAcrossCommand"
											CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
											CommandParameter="2"
											Content="{x:Static ml:MlResources.TwoPages}" />
									<Separator />
									<ListBox ItemsSource="{Binding PaperFormats}"
											Style="{StaticResource paperFormatListStyle}"
											SelectedItem="{Binding SelectedPaperFormat}" />
									<Separator />
									<ListBox ItemsSource="{Binding PaperOrientations}"
											Style="{StaticResource paperFormatListStyle}"
											SelectedItem="{Binding SelectedPaperOrientation}" />
									<Separator />
									<StackPanel Orientation="Horizontal">
										<TextBlock Text="{x:Static ml:MlResources.PageBorder}" Margin="0,0,5,0"
												VerticalAlignment="Center" />
										<ComboBox ItemsSource="{Binding PageMargins}" Width="40"
												SelectedItem="{Binding SelectedPageMargin}" />
									</StackPanel>
								</ToolBar>

								<ScrollViewer Grid.Row="1" CanContentScroll="true"
										HorizontalScrollBarVisibility="Auto"
										x:Name="PART_ContentHost" IsTabStop="true">
									<ScrollViewer.Background>
										<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
											<GradientStop
													Color="{DynamicResource ControlLightColor}"
													Offset="0" />
											<GradientStop
													Color="{DynamicResource ControlMediumColor}"
													Offset="1" />
										</LinearGradientBrush>
									</ScrollViewer.Background>
								</ScrollViewer>
							</Grid>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</Window.Resources>

	<Grid DataContext="{Binding ElementName=root}">
		<DocumentViewer x:Name="documentViewer" Document="{Binding Document}"
				Style="{StaticResource documentViewerStyle}" />
	</Grid>

</Window>
